<?php

namespace App\Console\Commands;

use App\Models\Buildings;
use Illuminate\Console\Command;
use App\Models\System;
class Tark extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'tark';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'update data building';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $user_count = System::find(1);
        $user_count->user_count = $user_count->user_count+rand(65,75);
        $user_count->update();

        $build = Buildings::get();
        $count = rand(17,21);
        foreach ($build as $row){
            $row->vote_count= $row->vote_count+$count;
            $row->update();
        }
    }
}
